package algorithms.common;

public class CommonIOUtil {
	public static void printArray(int[] array){
		char delimiter = ',';
		StringBuilder strBuilder = new StringBuilder("[");
		for(int i:array){
			strBuilder.append(i);
			strBuilder.append(delimiter);
		}
		strBuilder.setLength(strBuilder.length()-1);
		strBuilder.append(']');
		System.out.println(strBuilder);
	}
	
	public static boolean isArrayContainEqualEntries(int[] firstArray, int[] secondArray){
		boolean isEqual = true;
		if(firstArray.length != secondArray.length){
			isEqual = false;
		}
		else{
			for(int i=0;i<firstArray.length;i++){
				if(firstArray[i] != secondArray[i]){
					isEqual = false;
				}
			}
		}
		
		return isEqual;
	}
	
	public static int minimumElement(int[] arr){
		int minElement = Integer.MAX_VALUE;
		for(int i:arr){
			if(i<minElement){
				minElement = i;
			}
		}
		return minElement;
	}
}
